package com.skyable.auth.utils;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;

/**
 * @author GaoYuan
 * @title: IOUtil
 * @projectName private-cloud
 * @description: TODO
 * @date 2021/6/239:41
 */
@Slf4j
public class IOUtil {

    public static String getRequestBody(HttpServletRequest request) {
        StringBuilder wholeStr = new StringBuilder();
        try {
            BufferedReader br = request.getReader();
            String str = "";
            while ((str = br.readLine()) != null) {
                wholeStr.append(str);
            }
        } catch (Exception e) {
            log.error("get request body info error", e);
        }
        return wholeStr.toString();
    }

}
